<template>
  <div class="wrap">
    <Navbar :appTitle="title" />
    <div class="wrap">
      <div class="head">
        <p class="title">
          <span>生产订单编号：</span>
          <span>{{ detailData.code }}</span>
        </p>
        <p class="content">
          <span class="key">订单提交时间：</span>
          <span class="value">{{ detailData.createdTime }}</span>
        </p>
        <p class="content">
          <span class="key">订单提交人：</span>
          <span class="value">{{ detailData.createdByText }}</span>
        </p>
      </div>
      <div class="box" v-if="$route.query.type == 1">
        <div class="title">
          <span class="icon"></span>
          <span class="titlekey">派单信息</span>
        </div>
        <div class="body">
          <p class="content">
            <span class="key">生产负责人：</span>
            <span class="value">{{ detailData.chargeUserIdText }}</span>
          </p>
          <p class="content">
            <span class="key">工艺路线：</span>
            <span class="value">{{ detailData.craftName }}</span>
          </p>
          <p class="content">
            <span class="key">派单时间：</span>
            <span class="value">{{ detailData.distributeTime }}</span>
          </p>
          <p class="content">
            <span class="key">派单人：</span>
            <span class="value">{{ detailData.distributeByText }}</span>
          </p>
        </div>
      </div>
      <div class="box">
        <div class="title">
          <span class="icon"></span>
          <span class="titlekey">生产商品</span>
        </div>
        <div class="body">
          <p class="content">
            <span class="key">商品编号：</span>
            <span class="value">{{ detailData.goodsCode }}</span>
          </p>
          <p class="content">
            <span class="key">商品名称：</span>
            <span class="value">{{ detailData.goodsName }}</span>
          </p>
          <p class="content">
            <span class="key">商品规格：</span>
            <span class="value">{{ detailData.spec }}</span>
          </p>
          <p class="content">
            <span class="key">计划生产数量：</span>
            <span class="value" style="color: red">{{
              detailData.planProductNumUnitText
            }}</span>
          </p>
          <p class="content">
            <span class="key">承诺交期：</span>
            <span class="value">{{ detailData.promiseDate }}</span>
          </p>
        </div>
      </div>
      <div class="box">
        <div class="title">
          <span class="icon"></span>
          <span class="titlekey">订单来源</span>
        </div>
        <div class="body">
          <p class="content">
            <span class="key">销售合同编号：</span>
            <span class="value" style="color: #1890ff">{{
              detailData.contractCode
            }}</span>
            <span
              class="copy"
              :data-clipboard-text="detailData.contractCode"
              @click="copy"
              >复制</span
            >
          </p>
          <p class="content">
            <span class="key">合同订购量：</span>
            <span class="value">{{ detailData.saleNumUnitText }}</span>
          </p>
          <p class="content">
            <span class="key">订购基本单位：</span>
            <span class="value">{{ detailData.saleBaseNumUnitText }}</span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Navbar from "@/components/navBar/navBar_right";
import { getAction } from "@/api/manage";
import Clipboard from "clipboard";
export default {
  name: "proOrderDetail",
  components: { Navbar },
  data() {
    return {
      title: this.$route.meta.title,
      detailData: {},
    };
  },
  computed: {},
  mounted() {},
  created() {
    this.detailData = this.$route.query.item;
    console.log(this.detailData, "this.detailData");
    // getAction('/planmgt/erpProductScheduling/queryById',{id:this.$route.query.id}).then(res=>{
    //   console.log(res,'详情')
    // })
  },
  methods: {
    copy() {
      var clipboard = new Clipboard(".copy");
      clipboard.on("success", (e) => {
        this.$toast("复制成功");
        //  释放内存
        clipboard.destroy();
      });
      clipboard.on("error", (e) => {
        // 不支持复制
        this.$toast("复制失败");
        // 释放内存
        clipboard.destroy();
      });
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/detail.scss";
</style>